subroutine ReadDataFile(gam,mu,khi &
                         ,CFL,UFON,VFON,WFON,ROFON,PFON,TFON &
                         ,nstop,nprint,BoundType,utmp,ivertex,xc,irestart,scale,xlc,accel &
                         ,sound,eps,rwall,omega,dtOut, &
                         TimeInitial, TimeStepInitial, TimeStepMax, TimeStepMin)
use Data_cfoam, only: fname,nump,rank, ierr, ZeroEpsilon, nTimeStepAcceleration, nTimeStepAccelerationStart, &
                      epsilonPanikovski, JustMeshCellFaceCentersOut, &
                      TotalPresTempGiven, epsMaximumPrinciple, &
                      CalcBoundaryFaceCubesOnly, OutputFaceCubesOnly, &
                      NewPeriodicNumeration, PeriodicBound1, PeriodicBound2, SplitPeriodicBoundaries, autoRestart, &
                      meshFactor, PreprOnly, NormalChars, &
                      writeInitCondOn, nonReflectOutletBC
use Data_Transducer
use Acoustics, only: nAcousticSurfaces,AcousticSurface, nListeners,Listener
use DataTime, only: AsynchronousTime,TimeEpsilon
use DataPerfectGas, only: BulkViscConst, SutherlandsLaw
use DataSource
use DataBoundarySource
use InletBoundaryConditions, only: InletBCon, InletBCon_direction, InitCondInletBCon
IMPLICIT NONE
include 'mpif.h'

!    character (*) nam1
    real *8 gam,mu,khi,scale,xlc(3,10)
    real *8 utmp(8,100)
    real *8 pfon,rofon,ufon,vfon,wfon,tfon,cfl
    real *8 accel,sound,rwall
    real *8 eps
    real *8 omega,n,dtOut
    real(8),intent(inout) :: TimeInitial, TimeStepInitial, TimeStepMax, TimeStepMin
    
    integer ivertex
    integer irestart
    real *8 xc(3)
    real epsilon
    integer nprint,nstop
    integer BoundType(100)
    integer i,j
    real*8 u_inlet(100),v_inlet(100),w_inlet(100),               &
            p_inlet(100),ro_inlet(100),u_outlet(100),v_outlet(100)      &
            ,w_outlet(100),p_outlet(100),ro_outlet(100),t0_inlet(100),  &
            t0_outlet(100)
    real *8 xloc(3,10)
    real(8) TimeEnd
    
    ! Material
    integer :: ierrMaterial
    real(8) :: BulkViscConstRead
    character(5) :: ViscSutherlandsLaw
    
    ! Solution
    integer :: ierrSolution
    character(5) :: TotalPresTempAreGiven
    character(5) :: ReadInletBoundaryConditions, InitCondFromInletBoundaryConditions
    
    ! Tuning
    integer :: ierrTuning
    real(8) :: meshFactorX,meshFactorY,meshFactorZ
    character(5) :: Asynchrony, autoRes, writeInitConditions
!    integer :: nTimeStepAcceleration
        
    ! Transducer Data
    integer :: ierrTransducer
    character(50) :: TransName(100), TransContourFile(100), TransOutputFile(100)
    character(100) :: TransWriteVariable(100)
    character(5) :: TransDefCellsFromContour(100), TransLeftDiscActive(100), TransRightDiscActive(100)
    real(8) :: TransCenterDirX(100), TransCenterDirY(100), TransCenterDirZ(100), TransLength(100)
    real(8) :: TransTimeStart(100), TransTimeEnd(100), TransFactor(100), TransDTimeOut(100)
    character(50) :: TransTableOut(100), TransSliceOut(100), TransAverage(100)
	real(8) :: TransStepX(100),TransStepY(100),TransStepZ(100)
	integer :: TransBoundaryOut(100)
	character(50) :: TransBoundaryOutFile(100)
	character(5) :: TransHollow(100), TransdPdtOut(100), TransEveryStep(100), TransInsideOnly(100)
	real(8) :: TransLocationX(100),TransLocationY(100),TransLocationZ(100)
	real(8) :: TransInitVal(100),TransScaleFactor(100)
	integer :: TransnLayers(100)

    ! &AcousticSurfaces
    integer ierrAcousticSurfaces
    character(50) :: SurfName(100), SurfContourFile(100)
    character(5) :: SurfDefCellsFromContour(100)
	real(8) :: SurfCenterDirX(100),SurfCenterDirY(100),SurfCenterDirZ(100)
	character(5) :: SurfLeftDiscActive(100),SurfRightDiscActive(100)
	real(8) :: SurfFactor(100),SurfLength(100)
	real(8) :: SurfTimeStart(100), SurfTimeEnd(100), SurfDTimeOut(100)
	character(50) :: SurfAcousticsOut(100)
	character(5) :: SurfSphere(100)
	real(8) :: SurfCenterX(100), SurfCenterY(100), SurfCenterZ(100), SurfRadius(100)
	character(5) :: SurfMeshDataOut(100)
	integer :: SurfBoundary(100)

    ! &Listener
    integer :: ierrListeners
	character(50) :: ListenerName(100)
	real(8) :: ListenerLocationX(100),ListenerLocationY(100),ListenerLocationZ(100)
	
	! &Sources
    integer :: ierrSources
	real(8) :: SourceX, SourceY, SourceZ, SourceAmplitude, SourcePeriodDiv2Pi
	
	! &BoundarySources
    integer :: ierrBoundSources

    ! --------------------------------------------------
    
    integer :: iCell, iProc


    NAMELIST /material/ mu,khi,GAM, BulkViscConstRead, ViscSutherlandsLaw

    NAMELIST /solution/ CFL,UFON,VFON,WFON,ROFON,PFON &
            ,tfon,SCALE,xloc,accel,sound,epsilon,rwall,n,dtOut, &
            TimeInitial, TimeEnd, TimeStepInitial, TimeStepMin, TimeStepMax, &
            epsilonPanikovski,epsMaximumPrinciple, TotalPresTempAreGiven, &
            ReadInletBoundaryConditions, InletBCon_direction, InitCondFromInletBoundaryConditions
                ! EndTime, MaxTimeStep are absent, it's for future // VSemiletov

    NAMELIST /printing/ nprint,NSTOP,irestart

    NAMELIST /BoundCond/ BoundType,u_inlet,v_inlet,w_inlet ,p_inlet     &
            ,ro_inlet,t0_inlet,u_outlet,v_outlet,w_outlet,ro_outlet ,p_outlet  &
            ,t0_outlet !,  name

    NAMELIST /vertex/ ivertex,xc


    namelist /Tuning/ &
            nTimeStepAcceleration, &
            nTimeStepAccelerationStart, &
            JustMeshCellFaceCentersOut, &
            Asynchrony, &
            CalcBoundaryFaceCubesOnly, &
            OutputFaceCubesOnly, &
            NewPeriodicNumeration, &
            PeriodicBound1, &
            PeriodicBound2, &
            SplitPeriodicBoundaries, &
            autoRes, &
            meshFactorX, &
            meshFactorY, &
            meshFactorZ, &
            PreprOnly, &
            NormalChars, &
            writeInitConditions, &
            nonReflectOutletBC
    
    NAMELIST /Transducers/ &
            TransName , &
            TransContourFile , &
            TransOutputFile, &
            TransWriteVariable, &
            TransDefCellsFromContour, &
            TransLeftDiscActive, &
            TransRightDiscActive, &
            TransCenterDirX, &
            TransCenterDirY, &
            TransCenterDirZ, &
            TransLength, &
            TransFactor, &
            TransTimeStart, &
            TransTimeEnd, &
            TransDTimeOut, &
            TransStepX, &
            TransStepY, &
            TransStepZ, &
            TransTableOut, TransSliceOut, TransAverage, &
            TransBoundaryOut, TransBoundaryOutFile, &
            TransHollow, &
            TransInsideOnly, &
            TransdPdtOut, &
            TransEveryStep, &
            TransLocationX,TransLocationY,TransLocationZ, &
            TransInitVal,TransScaleFactor,TransnLayers
            
    namelist /AcousticSurfaces/ &
            SurfName, SurfContourFile, SurfDefCellsFromContour, &
            SurfCenterDirX,SurfCenterDirY,SurfCenterDirZ, &
            SurfLeftDiscActive,SurfRightDiscActive, SurfFactor,SurfLength, &
            SurfTimeStart, SurfTimeEnd, SurfDTimeOut, &
            SurfAcousticsOut, &
            SurfSphere, &
	        SurfCenterX, &
	        SurfCenterY, &
	        SurfCenterZ, &
	        SurfRadius, &
            SurfMeshDataOut, &
            SurfBoundary

    namelist /Listeners/ &
	        ListenerName, &
	        ListenerLocationX,ListenerLocationY,ListenerLocationZ

    namelist /Sources/ &
	        SourceX, SourceY, SourceZ, &
	        SourceAmplitude, SourcePeriodDiv2Pi, &
	        SourceStartTime

	namelist /BoundSources/ &
	        iBoundSurf, coef_af, coef_bf, coef_cf, coef_Omega, coef_Beta
    
	
!    do iProc = 1,nump
!    
!    call MPI_Barrier(MPI_COMM_WORLD,ierr)
!
!    if(rank.ne.iProc-1) cycle

!    nTimeStepAcceleration = 20000
!    nTimeStepAccelerationStart = 0

    do i = 1,100
        TransName(i)(1:1) = ' '
        SurfName(i)(1:1) = ' '
        ListenerName(i)(1:1) = ' '
        TransStepX(i) = 1.0d-10
        TransStepY(i) = 1.0d-10
        TransStepZ(i) = 1.0d-10
        TransBoundaryOut(i) = -1
        SurfAcousticsOut(i)(1:1) = ' '
        
        TransCenterDirX(i) = 1d0
        TransCenterDirY(i) = 0d0
        TransCenterDirZ(i) = 0d0
        
        TransLocationX(i) = -1d10
        TransLocationY(i) = 0d0
        TransLocationZ(i) = 0d0
        
        TransInitVal(i) = 0d0
        TransScaleFactor(i) = 0d0
        TransnLayers(i) = 0
        
        SurfBoundary(i) = 0
    end do

    xloc=0.0d0
    n=0.0d0
    TimeInitial = 0.0
    TimeStepInitial = 1d-8
!    TimeStepMin = 1d-10
!    TimeStepMax = 1d+10
    dtOut = -999.0d0

    BulkViscConstRead = 1d0

    meshFactorX = 1d0
    meshFactorY = 1d0
    meshFactorZ = 1d0

    OPEN(UNIT=2, FILE=fname,   STATUS='OLD',action='read') !readonly)
    READ(2,material,iostat=ierrMaterial)
    rewind 2
    READ(2,solution,iostat=ierrSolution)
    rewind 2
    READ(2,printing)
    rewind 2
    READ(2,vertex)      
    rewind 2
    READ(2,BoundCond)  
    rewind 2
    read(2,Tuning,iostat=ierrTuning)
    rewind 2
    read(2,Transducers,iostat=ierrTransducer)
    rewind 2
    read(2,AcousticSurfaces,iostat=ierrAcousticSurfaces)
    rewind 2
    read(2,Listeners,iostat=ierrListeners)
    rewind 2
    read(2,Sources,iostat=ierrSources)
    rewind 2
    read(2,BoundSources,iostat=ierrBoundSources)
    close(2)
    

    do i = 1,100
        SurfDTimeOut(i) = dtout
    end do

    do i=1,100
        if (BoundType(i).eq.2) then ! INLET
            !	write(*,*) i,u_inlet(i),v_inlet(i),w_inlet(i),p_inlet(i)
            !     * ,ro_inlet(i),t0_inlet(i)
            utmp(1,i)=u_inlet(i)	
            utmp(2,i)=v_inlet(i)	
            utmp(3,i)=w_inlet(i)	
            !	utmp(4,i)=ro_inlet(i)	
            utmp(5,i)=p_inlet(i)	
            utmp(4,i)=t0_inlet(i)	
        end if
        if (BoundType(i).eq.1) then ! OUTLET
            !	write(*,*) i,u_outlet(i),v_outlet(i),w_outlet(i),p_outlet(i)
            !     * ,ro_outlet(i),t0_outlet(i)
            utmp(1,i)=u_outlet(i)	
            utmp(2,i)=v_outlet(i)	
            utmp(3,i)=w_outlet(i)	
            !	utmp(4,i)=ro_outlet(i)	
            utmp(5,i)=p_outlet(i)	
            utmp(4,i)=t0_outlet(i)	
        end if

        if (BoundType(i).eq.3) then ! WALL
            !	write(*,*) i, ' is type 3'
        end if
        if (BoundType(i).eq.4) then ! WALL
            !	write(*,*) i, ' is type 4'
            !	write(*,*) 'Wall temperature ',t0_inlet(i)
            utmp(4,i)=t0_inlet(i)
        end if
        if (BoundType(i).eq.5) then ! PERIODIC
            !	write(*,*) i, ' is type 5 (periodic)'
            !	write(*,*) i,u_inlet(i),v_inlet(i),w_inlet(i)
            utmp(1,i)=u_inlet(i)	
            utmp(2,i)=v_inlet(i)	
            utmp(3,i)=w_inlet(i)	
        end if
    end do
    
    do i=1,10
        xlc(1:3,i)=xloc(1:3,i)
    end do
    
    eps=epsilon
    omega=2d0*3.1415927d0*n
    
! ++++ Material ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrMaterial.eq.0)then
        BulkViscConst = BulkViscConstRead
        if(BulkViscConst.lt.0)then
            Stop '@@Fatal Error: BulkViscConst < 0'
        end if

        call DefLogicalParameter(ViscSutherlandsLaw,SutherlandsLaw)
    end if
    
! ++++ Solution+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrSolution.eq.0)then
        call DefLogicalParameter(TotalPresTempAreGiven,TotalPresTempGiven)
        
        call DefLogicalParameter(ReadInletBoundaryConditions,InletBCon)
        
        call DefLogicalParameter(InitCondFromInletBoundaryConditions,InitCondInletBCon)
    end if
    
    if(dtOut.le.0)then
        stop '@@ Fatal Error: dtOut <=0 or is not given!'
    end if
    TimeStepMin = min(dtOut,TimeStepMin)
    TimeStepMax = min(dtOut,TimeStepMax)
    if(TimeEpsilon - TimeStepMin.ge.-TimeEpsilon)then
        TimeEpsilon = 0.1d0 * TimeStepMin
    end if
    
! ++++ Tuning ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrTuning.eq.0)then
!        ntimemax = nTimeStepAcceleration
        call DefLogicalParameter(Asynchrony,AsynchronousTime)
        
        call DefLogicalParameter(autoRes,autoRestart)
        
        call DefLogicalParameter(writeInitConditions,writeInitCondOn)

        if(rank.eq.0)then
            write(*,*) 'AsynchronousTime=', AsynchronousTime
        end if
        
        meshFactor(1) = meshFactorX
        meshFactor(2) = meshFactorY
        meshFactor(3) = meshFactorZ
    else
        if(rank.eq.0)then
            write(*,*) '@Tuning is wrong!'
        end if
    end if
    
! ++++ Transducer Reading ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

!    if(rank.eq.0)then
!        write(*,*) 'Transducers test!'
!        write(*,*) 'ierrTransducer =', ierrTransducer
!        write(*,*) 'TransName(1)=', TransName(1)
!        write(*,*) 'TransContourFile(1)=', TransContourFile(1)
!        write(*,*) 'TransOutputFile(1)=', TransOutputFile(1)
!        write(*,*) 'TransWriteVariable(1)=', TransWriteVariable(1)
!        write(*,*) 'TransDefCellsFromContour(1)=', TransDefCellsFromContour(1)
!        write(*,*) 'TransLeftDiscActive(1)=', TransLeftDiscActive(1)
!        write(*,*) 'TransRightDiscActive(1)=', TransRightDiscActive(1)
!        write(*,*) 'TransCenterDirX(1)=', TransCenterDirX(1)
!        write(*,*) 'TransCenterDirY(1)=', TransCenterDirY(1)
!        write(*,*) 'TransCenterDirZ(1)=', TransCenterDirZ(1)
!        write(*,*) 'TransLength(1)=', TransLength(1)
!        write(*,*) 'TransFactor(1)=', TransFactor(1)
!        write(*,*) 'TransTimeStart(1)=', TransTimeStart(1)
!        write(*,*) 'TransTimeEnd(1)=', TransTimeEnd(1)
!        write(*,*) 'TransDTimeOut(1)=', TransDTimeOut(1)
!        write(*,*) 'TransAverage(1)=', TransAverage(1)
!        write(*,*) 'TransSliceOut(1)=', TransSliceOut(1)
!        write(*,*) 'TransTableOut(1)=', TransTableOut(1)
!        write(*,*) 'TransBoundaryOut(1)=', TransBoundaryOut(1)
!        write(*,*) 'TransBoundaryOutFile(1) =', TransBoundaryOutFile(1)
!        write(*,*) '--------------------------------------------------------'
!    end if

    if(ierrTransducer.eq.0)then
        nTransducers = 0
        do i=1,100
            if(TransName(i)(1:1).ne.' ') nTransducers = nTransducers + 1
        end do
        if(nTransducers.gt.0)then
            allocate(Transducer(nTransducers))
        end if
        do i = 1,nTransducers
            Transducer(i)%name(1:50) = TransName(i)(1:50)
            Transducer(i)%fileOutput = TransOutputFile(i)

            Transducer(i)%nameLength = 50
            do j = 1,50
                !if(TransName(i)(j:j).eq.' ')then
                if(TransOutputFile(i)(j:j).eq.' ')then
                    Transducer(i)%nameLength = j-1
                    exit
                end if
            end do
            
            Transducer(i)%fileCellsInput(1:50) = TransContourFile(i)(1:50)
!            
            Transducer(i)%TimeStart = TransTimeStart(i)
            Transducer(i)%TimeEnd = TransTimeEnd(i)
            Transducer(i)%dTimeOut = TransDTimeOut(i)
            
            Transducer(i)%factor = TransFactor(i)
            
            Transducer(i)%nVars = 0
            do j = 1,5 ! Pres,Uvel,Vvel,Wvel,Temp
                if(TransWriteVariable(i)(1 + 5*(j-1):1 + 5*(j-1)).eq.' ') exit
                Transducer(i)%nVars = Transducer(i)%nVars + 1
            end do

            if(Transducer(i)%nVars.eq.0)then
                STOP '@@FATAL ERROR: nameVars'
            end if
            
            do j = 1,Transducer(i)%nVars ! Pres,Uvel,Vvel,Wvel,Temp
                if(TransWriteVariable(i)(1 + 5*(j-1):4 + 5*(j-1)).eq.'Pres') Transducer(i)%Pres = .true.
                if(TransWriteVariable(i)(1 + 5*(j-1):4 + 5*(j-1)).eq.'Uvel') Transducer(i)%Uvel = .true.
                if(TransWriteVariable(i)(1 + 5*(j-1):4 + 5*(j-1)).eq.'Vvel') Transducer(i)%Vvel = .true.
                if(TransWriteVariable(i)(1 + 5*(j-1):4 + 5*(j-1)).eq.'Wvel') Transducer(i)%Wvel = .true.
                if(TransWriteVariable(i)(1 + 5*(j-1):4 + 5*(j-1)).eq.'Temp') Transducer(i)%Temp = .true.
            end do

            if(TransDefCellsFromContour(i)(1:2).eq.'On'.or.TransDefCellsFromContour(i)(1:2).eq.'on')then
                Transducer(i)%CalcCellsFromContour = .true.
            end if
            if(TransLeftDiscActive(i)(1:2).eq.'On'.or.TransLeftDiscActive(i)(1:2).eq.'on')then
                Transducer(i)%LeftDiscActive = .true.
            end if
            if(TransRightDiscActive(i)(1:2).eq.'On'.or.TransRightDiscActive(i)(1:2).eq.'on')then
                Transducer(i)%RightDiscActive = .true.
            end if

            if(TransTableOut(i)(1:2).eq.'On'.or.TransTableOut(i)(1:2).eq.'on')then
                Transducer(i)%TableOut = .true.
            end if
            if(TransTableOut(i)(1:2).eq.'Of'.or.TransTableOut(i)(1:2).eq.'of')then
                Transducer(i)%TableOut = .false.
            end if
            
            if(TransSliceOut(i)(1:2).eq.'On'.or.TransSliceOut(i)(1:2).eq.'on')then
                Transducer(i)%SliceOut = .true.
            end if
            if(TransSliceOut(i)(1:2).eq.'Of'.or.TransSliceOut(i)(1:2).eq.'of')then
                Transducer(i)%SliceOut = .false.
            end if
            
            if(TransAverage(i)(1:2).eq.'On'.or.TransAverage(i)(1:2).eq.'on')then
                Transducer(i)%Average = .true.
            end if
            if(TransAverage(i)(1:2).eq.'Of'.or.TransAverage(i)(1:2).eq.'of')then
                Transducer(i)%Average = .false.
            end if

            if(TransHollow(i)(1:2).eq.'On'.or.TransHollow(i)(1:2).eq.'on')then
                Transducer(i)%Hollow = .true.
            end if
            if(TransHollow(i)(1:2).eq.'Of'.or.TransHollow(i)(1:2).eq.'of')then
                Transducer(i)%Hollow = .false.
            end if
            
            call DefLogicalParameter(TransdPdtOut(i),Transducer(i)%dPdtOut)
            call DefLogicalParameter(TransEveryStep(i),Transducer(i)%EveryStep)
            call DefLogicalParameter(TransInsideOnly(i),Transducer(i)%insideOnly)
            
            if(TransCenterDirX(i)**2+TransCenterDirY(i)**2+TransCenterDirZ(i)**2.lt.ZeroEpsilon)then
                if(rank.eq.0)then
                    write(*,'(a30,a20,a15)') '@@ Fatal Error: in Transducer ', Transducer(i)%name, '|CenterDir|=0.0'
                end if
                STOP '@@ FATAL ERROR'
            end if

            Transducer(i)%CenterDir(1) = TransCenterDirX(i)
            Transducer(i)%CenterDir(2) = TransCenterDirY(i)
            Transducer(i)%CenterDir(3) = TransCenterDirZ(i)
            
            
            Transducer(i)%StepX = TransStepX(i)
            Transducer(i)%StepY = TransStepY(i)
            Transducer(i)%StepZ = TransStepZ(i)

            Transducer(i)%length = TransLength(i)
            
            Transducer(i)%BoundaryOut = TransBoundaryOut(i)
            Transducer(i)%BoundaryOutFile = TransBoundaryOutFile(i)
            
            if(TransLocationX(i).gt.-1d9)then
                Transducer(i)%PointLocation = .true.
                Transducer(i)%Location(1) = TransLocationX(i)
                Transducer(i)%Location(2) = TransLocationY(i)
                Transducer(i)%Location(3) = TransLocationZ(i)
            end if

	        Transducer(i)%InitVal = TransInitVal(i)
            Transducer(i)%ScaleFactor = TransScaleFactor(i)
            Transducer(i)%nLayers = TransnLayers(i)

        end do
        if(rank.eq.0)then
            write(*,*) 'Number of Transducers = ', nTransducers
        end if
    else
        if(rank.eq.0)then
            if(TransName(i)(1:1).ne.' ')then
                write(*,*) '@Transducer is wrong!'
            end if
        end if
    end if

! ++++++ Acoustic Surfaces Reading ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrAcousticSurfaces.eq.0)then
        nAcousticSurfaces = 0
        do i=1,100
            if(SurfName(i)(1:1).ne.' ') nAcousticSurfaces = nAcousticSurfaces + 1
        end do
        if(nAcousticSurfaces.gt.0)then
            allocate(AcousticSurface(nAcousticSurfaces))
        end if
        do i = 1,nAcousticSurfaces
            AcousticSurface(i)%name(1:50) = SurfName(i)(1:50)
            AcousticSurface(i)%nameLength = 50
            do j = 1,50
                if(SurfName(i)(j:j).eq.' ')then
                    AcousticSurface(i)%nameLength = j-1
                    exit
                end if
            end do
            AcousticSurface(i)%fileContourIn(1:50) = SurfContourFile(i)(1:50)
!            AcousticSurface(i)%fileContourOut(1:50) = SurfContourFile(i)(1:50)
            if(SurfDefCellsFromContour(i)(1:2).eq.'On'.or.SurfDefCellsFromContour(i)(1:2).eq.'on')then
                AcousticSurface(i)%DefCellsFromContour = .true.
            end if
            
	        AcousticSurface(i)%CenterDir(1) = SurfCenterDirX(i)
	        AcousticSurface(i)%CenterDir(2) = SurfCenterDirY(i)
	        AcousticSurface(i)%CenterDir(3) = SurfCenterDirZ(i)
	        if(SurfLeftDiscActive(i)(1:2).eq.'On'.or.SurfLeftDiscActive(i)(1:2).eq.'on')then
                AcousticSurface(i)%LeftDiscActive = .true.
            end if
            if(SurfRightDiscActive(i)(1:2).eq.'On'.or.SurfRightDiscActive(i)(1:2).eq.'on')then
                AcousticSurface(i)%RightDiscActive = .true.
            end if

	        AcousticSurface(i)%Length = SurfLength(i)
	        AcousticSurface(i)%factor = SurfFactor(i)
	        
	        AcousticSurface(i)%timeStart = SurfTimeStart(i)
	        AcousticSurface(i)%timeEnd   = SurfTimeEnd(i)
	        AcousticSurface(i)%dTimeOut  = SurfDTimeOut(i)
	        
	        AcousticSurface(i)%AcousticsOut(1:50) = SurfAcousticsOut(i)(1:50)
	        AcousticSurface(i)%LengthAcousticsOut = 50
            do j = 1,50
                if(SurfAcousticsOut(i)(j:j).eq.' ')then
                    AcousticSurface(i)%LengthAcousticsOut = j-1
                    exit
                end if
            end do
            
            if(AcousticSurface(i)%AcousticsOut(1:1).eq.' ')then
                AcousticSurface(i)%CalcAcoustics = .true.
            else
                AcousticSurface(i)%CalcAcoustics = .false.
            end if

            call DefLogicalParameter(SurfSphere(i),AcousticSurface(i)%Sphere)

            AcousticSurface(i)%Center(1) = SurfCenterX(i)
	        AcousticSurface(i)%Center(2) = SurfCenterY(i)
	        AcousticSurface(i)%Center(3) = SurfCenterZ(i)
	        AcousticSurface(i)%Radius = SurfRadius(i)
	        
	        call DefLogicalParameter(SurfMeshDataOut(i),AcousticSurface(i)%MeshDataOut)
	        
	        AcousticSurface(i)%nBoundary = SurfBoundary(i)
	        if(SurfBoundary(i).gt.0)then
	            if(AcousticSurface(i)%DefCellsFromContour)then
    	            AcousticSurface(i)%DefCellsFromContour = .false.
    	            if(rank.eq.0)then
    	                write(*,*) '@Warning: As SurfBoundary>0 in acoustic surface number ', i,' DefCellsFromContour = .false.!'
    	            end if
    	        end if
	        end if
	    end do
	else
        if(rank.eq.0)then
            write(*,*) '@Warning: ierrAcousticSurfaces != 0 ...'
                   
            write(*,*) 'SurfName=',SurfName(1)
            write(*,*) 'SurfContourFile=',SurfContourFile(1)
            write(*,*) 'SurfDefCellsFromContour=',SurfDefCellsFromContour(1)
            write(*,*) 'SurfCenterDirX=',SurfCenterDirX(1)
            write(*,*) 'SurfCenterDirY=',SurfCenterDirY(1)
            write(*,*) 'SurfCenterDirZ=',SurfCenterDirZ(1)
            write(*,*) 'SurfLeftDiscActive=',SurfLeftDiscActive(1)
            write(*,*) 'SurfRightDiscActive=',SurfRightDiscActive(1)
            write(*,*) 'SurfFactor=',SurfFactor(1)
            write(*,*) 'SurfLength=',SurfLength(1)
            write(*,*) 'SurfTimeStart=',SurfTimeStart(1)
            write(*,*) 'SurfTimeEnd=',SurfTimeEnd(1)
            write(*,*) 'SurfDTimeOut=',SurfDTimeOut(1)
            write(*,*) 'SurfAcousticsOut=',SurfAcousticsOut(1)
            write(*,*) 'SurfSphere=',SurfSphere(1)
	        write(*,*) 'SurfCenterX=',SurfCenterX(1)
	        write(*,*) 'SurfCenterY=',SurfCenterY(1)
	        write(*,*) 'SurfCenterZ=',SurfCenterZ(1)
	        write(*,*) 'SurfRadius=',SurfRadius(1)
            write(*,*) 'SurfMeshDataOut=',SurfMeshDataOut(1)
            write(*,*) 'SurfBoundary=',SurfBoundary(1)
        end if
    end if

	if(rank.eq.0)then
        write(*,*) 'Number of AcousticSurfaces = ', nAcousticSurfaces
    end if

! +++++++ Listener's data reading +++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrListeners.eq.0)then
        nListeners = 0
        do i=1,100
            if(ListenerName(i)(1:1).ne.' ') nListeners = nListeners + 1
        end do
        if(nListeners.gt.0)then
            allocate(Listener(nListeners))
        end if
        do i = 1,nListeners
            Listener(i)%name(1:50) = ListenerName(i)(1:50)
            Listener(i)%nameLength = 50
            do j = 1,50
                if(ListenerName(i)(j:j).eq.' ')then
                    Listener(i)%nameLength = j-1
                    exit
                end if
            end do
	        Listener(i)%Location(1) = ListenerLocationX(i)
	        Listener(i)%Location(2) = ListenerLocationY(i)
	        Listener(i)%Location(3) = ListenerLocationZ(i)
	    end do
    end if
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

! +++++++ Source's data reading +++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrSources.eq.0)then
        SourcePresent = .true.
        
        SourceLocation(1) = SourceX
        SourceLocation(2) = SourceY
        SourceLocation(3) = SourceZ
        Amplitude = SourceAmplitude
        PeriodDiv2Pi = SourcePeriodDiv2Pi
    end if
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

! +++++++ BoundSource's data reading +++++++++++++++++++++++++++++++++++++++++++++++++++++
    if(ierrBoundSources.eq.0)then
        BoundSourcePresent = .true.
    end if
! +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

!    end do

    return
end subroutine ReadDataFile

subroutine DefLogicalParameter(ParamIn,ParamOut)
implicit none
    character(2),intent(in) :: ParamIn
    logical,intent(out) :: ParamOut

    if(ParamIn(1:2).eq.'On'.or.ParamIn(1:2).eq.'on')then
        ParamOut = .true.
        return
    end if
    if(ParamIn(1:2).eq.'Of'.or.ParamIn(1:2).eq.'of')then
        ParamOut = .false.
        return
    end if
        
end subroutine DefLogicalParameter
